/*******************************************************************************
 * Copyright (c) 2006 CEA List.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     CEA List - initial API and implementation
 *******************************************************************************/
package com.cea.papyrus.core.editpart.connection;

import org.eclipse.draw2d.AbstractConnectionAnchor;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.geometry.Point;

/**
 * Anchor for connections/waypoints.
 * This Anchor is backuped to the model anchor
 */
public class PolylineRequestAnchor extends AbstractConnectionAnchor
{

	/**
	 * 
	 */
	protected Point location;



	/**
	 * Constructs a Anchor with the given <i>owner</i> figure.
	 * 
	 * @param pos The position of the anchor on the specified border. The position is specified as
	 * a percentage (between 0.0 and 1)
	 * @param owner The owner figure
	 * @param border The border where the anchor is located (NORTH, SOUTH, EAST, WEST).
	 * @param location 
	 * 
	 * @since 2.0
	 */
	public PolylineRequestAnchor(IFigure owner, Point location) {
		super(owner);
		this.location = location;
	}

	/**
	 * Gets a Rectangle from {@link #getBox()} and returns the Point where a line from the
	 * center of the Rectangle to the Point <i>reference</i> intersects the Rectangle.
	 * 
	 * @param reference The reference point
	 * 
	 * @return The anchor location
	 */
	public Point getLocation(Point reference) {
		Point ref = location.getCopy();
		return ref;
	}


	/**
	 * Returns the anchor's reference point. In the case of the ChopboxAnchor, this is the
	 * center of the anchor's owner.
	 * 
	 * @return The reference point
	 */
	public Point getReferencePoint() {
		Point ref = location.getCopy();
		return ref;
	}

}
